
//
//  TMloging.swift
//  GZWeibo007
//
//  Created by myd on 15/12/24.
//  Copyright © 2015年 Apple. All rights reserved.
//

import UIKit

class TMloging: UITableViewCell {
    let juhua = UIActivityIndicatorView()
    let lab = UILabel()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setview()
        //        self.backgroundColor = UIColor.redColor()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setview()
    {
        
        juhua.color = UIColor.grayColor()
        contentView.addSubview(juhua)
        juhua.startAnimating()
        contentView.addSubview(lab)
        lab.text = "正在努力加载任务..."
        lab.textColor = UIColor.blackColor()
        lab.textAlignment = NSTextAlignment.Center
        setviewframe()
    }
    func  setviewframe()
    {
        juhua.translatesAutoresizingMaskIntoConstraints = false
        lab.translatesAutoresizingMaskIntoConstraints = false
        lab.sizeToFit()
        juhua.sizeToFit()
        self.addConstraint(NSLayoutConstraint(item: lab, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: contentView, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: -20))
        self.addConstraint(NSLayoutConstraint(item: lab, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: contentView, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant:0))
        self.addConstraint(NSLayoutConstraint(item: juhua, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: lab, attribute: NSLayoutAttribute.Right, multiplier: 1, constant:20))
        self.addConstraint(NSLayoutConstraint(item: juhua, attribute:NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: lab, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant:0))
        
    }
    
}
